<?
session_start();
$msg_id = $_REQUEST['msg_id'];
$sender_id = $_REQUEST['sender_id'];

include('./../config/db_settings.php');
include('pms_inc.php');
include('pms_inc2.php');

$user = $_SESSION[$settings['session_prefix'].'user_id'];

if($msg_id>0){
	if(empty($sender_id))
	{
		header("Location:viewmsg.php?msg_id=".$msg_id."&backup=1");
	}
	else
	{
		header("Location:viewsentmsg.php?msg_id=".$msg_id."&backup=1");
	}

}else{
	if(empty($sender_id))
	{
		header("Location:inbox.php");
	}
	else
	{
		header("Location:sent.php");
	}
}

//Are they logged in or not?
if(!$user)
{
}
else
{

	if($msg_id>0)
	{
		$msgs=array($msg_id);
		pm2email($msgs,$user);
	}
	else
	{
		pm2email($_POST['pms'],$user);
	}
}
?>